#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
const ll N = 500, mod = 1e9 + 7;
ll dp[N][N], g[N];
ll n, m, v;
void solve()
{
    cin >> n >> m >> v;
    for (ll i = 1; i <= n; i++)
    {
        cin >> g[i];
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = g[i]; j <= v; j++)
        {
            for (ll k = 1; k <= m; k++)
            {
                dp[j][k] = (dp[j][k] + dp[j - g[i]][k - 1]) % mod;
            }
        }
    }
    ll ans = 0;

    for (ll i = 1; i <= v; i++)
    {
        ans = (ans + dp[i][m]) % mod;
    }
    cout << ans << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
